from django import template
from django.apps import apps

register = template.Library()

def is_selected_block(current_block, block):
    """ Проверяем выбран ли этот блок """

    if current_block == block:
        return 'selected_block'
    else:
        return ''


def convert_boolean(value):
    """ Преобразовываем Boolean в читаемое значение """

    if value == False:
        return 'Нет'
    elif value == True:
        return 'Да'


register.filter('is_selected_block', is_selected_block)
register.filter('convert_boolean', convert_boolean)
